<template>
  <div class="topic">
    <div v-for="item in dateArr" :key="item.id">
      <img v-lazy="item.scene_pic_url"/>
      <p>{{item.title}}</p>
      <p>{{item.subtitle}}</p>
      <p class="price" v-if="item.price_info">{{item.price_info | Rmb}}</p>
    </div>
    <!-- 分页 -->
    <van-pagination v-model="page" :page-count="totolePage" mode="simple" @change="pageChange"/>
  </div>
</template>

<script>
import { getTopicDate } from "@/utils/http.js";
export default {
  name: "Topic",
  data() {
    return {
      page:1, //当前页数
      size:10, //每页条数
      dateArr: [],
      totolePage:1 //总页数
    };
  },
  mounted() {
    this.getData()
  },
  methods:{
    pageChange(){
      this.getData()
    },
    getData(){
      getTopicDate({page:this.page,size:this.size}).then((res) => {
      this.dateArr = res.data.data;
      this.totolePage = res.data.totalPages
    });
    }
  }
};
</script>

<style lang='less' scope>
.topic{
  padding-bottom: 70px;
  img{width: 100%;}
  p{
    text-align: center;
    margin: 30px 0;
    font-size: 18px;
    font-weight: 500;
  }
  .price{
    color: rgb(138, 97, 21);
    font-size: 15px;
  }
}
</style>